const nxmi = require('./build/Release/nxmi.node')
// hello是一个只有一个打印的函数
const hello = nxmi.hello();
console.log(hello);

const data = {
    yljgdm: '00000002',
    ip: '127.0.0.1',
    biztype: 'J2',
    data: '<?xml version="1.0" encoding="GBK"?><DATA> <HEAD> <VER>01.01</VER> <APP>J2</APP> <WorkDate>20181116</WorkDate> <Reserve></Reserve> <ErrCode></ErrCode> <ErrDetail></ErrDetail> </HEAD> <MSG> <HEAD> <YLJGDM>00000002</YLJGDM><JYRQ>20181116000000</JYRQ><MZZYBZ>0</MZZYBZ><ZXBXBZ>0</ZXBXBZ><ZHCXBZ>1</ZHCXBZ><DKXXBZ>1</DKXXBZ><PWD>1</PWD></HEAD></MSG></DATA>'
}

const data1 = {
    yljgdm: '00000002',
    ip: '127.0.0.1',
    biztype: 'F1',
    data: '<?xml version="1.0" encoding="GBK"?> <DATA> <HEAD> <ver>01.01</ver> <app>F1</app> </HEAD> <MSG> <HEAD> <YLJGDM>00000002</YLJGDM> <YYLSH>11111991</YYLSH> <YBLSH>20191129150516121626</YBLSH> <FPHM>0</FPHM> <SHBZH>2001389308</SHBZH> <JSRQ>20191211000000</JSRQ> <ZYTS>13</ZYTS> <CYRQ>20191212000000</CYRQ> <CYYY>0</CYYY> <ZTJSBZ>0</ZTJSBZ> <ZHZFBZ>0</ZHZFBZ> <ZYHM>1111199</ZYHM> <CZYXM>管理员</CZYXM> <CZRQ>20191212000000</CZRQ> <PRV1>0</PRV1> <PRV2>||</PRV2> <PRV4>1</PRV4> </HEAD> </MSG> </DATA>'
}

let params = {
    'functionname': 'bizbuss',
    'params': {
        'hid': data.yljgdm,
        'biztype': data.biztype,
        'ip': data.ip,
        'indata': data.data
    }
}

// var nxmi = require("nxmi")
let outdata = (nxmi.invoke(JSON.stringify(params))); // 'hello world'
/* let b = new Buffer.from(outdata, 'base64')
let s = b.toString('utf-8')
console.log(s); */

/* params = {
    'functionname': 'bizbuss',
    'params': {
        'hid': data1.yljgdm,
        'biztype': data1.biztype,
        'ip': data1.ip,
        'indata': data1.data
    }
}

outdata = (nxmi.invoke(JSON.stringify(params))); // 'hello world'
b = new Buffer.from(outdata, 'base64')
s = b.toString('utf-8')
 */